Skip to content

feat: @goose in terminal (native terminal support) - #5887

Merged
michaelneale merged 22 commits into
mainfrom
term-dmo
Dec 1, 2025
Merged

feat: @goose in terminal (native terminal support)#5887
michaelneale merged 22 commits into
mainfrom
term-dmo

Conversation

@DOsinga

@DOsinga DOsinga commented Nov 26, 2025

Copy link
Copy Markdown
Collaborator

Summary

Douwe's take on this saga :)

image

baxen and others added 17 commits November 22, 2025 12:18
Term command is a new way to use goose without the builtin REPL
- instead the session is tied right into your terminal
- Fix bash/zsh: properly quote goose binary path to handle spaces
- Extract session creation logic to ensure_terminal_session helper
- Reduces code duplication between handle_term_log and handle_term_run
Copilot AI review requested due to automatic review settings November 26, 2025 11:47
@DOsinga
DOsinga requested a review from a team as a code owner November 26, 2025 11:47
chrono::Utc::now().timestamp_millis(),
vec![MessageContent::text(command)],
)
.with_metadata(MessageMetadata::user_only());

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could leave this out since we truncate again

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do messages have an LLM only state? because these would be weird/spammy if you saw them in a GUI i think

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they are like what I saw, isn't end of the world.

@github-actions

github-actions Bot commented Nov 26, 2025

Copy link
Copy Markdown
Contributor
PR Preview Action v1.6.0
Preview removed because the pull request was closed.
2025-12-01 06:42 UTC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds terminal integration features to Goose, enabling users to interact with Goose directly from their shell prompt without switching to a separate REPL session. The integration tracks shell command history and provides it as context when users ask questions.

Key changes:

  • New SessionType::Terminal enum variant for terminal-specific sessions
  • New goose term CLI commands for shell initialization, command logging, and running prompts
  • Comprehensive documentation explaining setup and usage across multiple shells (bash, zsh, fish, PowerShell)

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
documentation/docs/guides/terminal-integration.md Complete user guide for terminal integration feature including setup, usage examples, and technical details
crates/goose/src/session/session_manager.rs Adds SessionType::Terminal variant for terminal-integrated sessions
crates/goose-cli/src/commands/term.rs Core implementation: shell initialization script generation, command logging, and prompt execution with shell history context
crates/goose-cli/src/commands/mod.rs Exports new term command module
crates/goose-cli/src/cli.rs CLI interface for goose term commands with subcommands for init, log, run, and info
Cargo.lock Dependency version update (windows-sys indirect dependency)

Comment thread documentation/docs/guides/terminal-integration.md Outdated
Copilot AI review requested due to automatic review settings November 26, 2025 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Comment thread crates/goose-cli/src/commands/term.rs
Comment thread documentation/docs/guides/terminal-integration.md Outdated
Comment thread crates/goose-cli/src/commands/term.rs
Comment on lines +1144 to +1146
COUNT(m.id) as message_count
FROM sessions s
INNER JOIN messages m ON s.id = m.session_id

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The INNER JOIN with messages excludes sessions with no messages. This breaks named session lookup - a newly created terminal session won't be found on the next term init call until it has messages. Use LEFT JOIN instead and COALESCE(COUNT(m.id), 0) for the message count.

Suggested change
COUNT(m.id) as message_count
FROM sessions s
INNER JOIN messages m ON s.id = m.session_id
COALESCE(COUNT(m.id), 0) as message_count
FROM sessions s
LEFT JOIN messages m ON s.id = m.session_id

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DOsinga this sounds so convincing but I am not so sure (also if it is true, I don't think this is a bad thing... I was wondering how do we get a fresh session)?

@baxen baxen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Feel free to retarget to my outstanding branch/PR and i will address the nits, or if you have time can merge directly

Comment thread crates/goose-cli/src/commands/term.rs Outdated

static BASH_CONFIG: ShellConfig = ShellConfig {
script_template: r#"export GOOSE_SESSION_ID="{session_id}"
alias gt='{goose_bin} term run'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i'd remove this now, but i like having both @goose and @g

chrono::Utc::now().timestamp_millis(),
vec![MessageContent::text(command)],
)
.with_metadata(MessageMetadata::user_only());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do messages have an LLM only state? because these would be weird/spammy if you saw them in a GUI i think

---
unlisted: true
---
# Terminal Integration

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a todo for future, would be nice to show how to set this up with
https://starship.rs/
and
https://github.com/ianthehenry/zsh-autoquoter

@michaelneale michaelneale changed the title Term dmo feat: @goose in terminal (native terminal support) Nov 27, 2025
@michaelneale michaelneale self-assigned this Nov 27, 2025
Copilot AI review requested due to automatic review settings November 27, 2025 01:27
@michaelneale

Copy link
Copy Markdown
Collaborator

ok, needs blessing from @blackgirlbytes (as this is a new PR with doc change) and I think we can get this in

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Comment thread documentation/docs/guides/terminal-integration.md Outdated
Comment thread crates/goose-cli/src/commands/term.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 1, 2025 04:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Comment thread crates/goose-cli/src/commands/term.rs
@michaelneale
michaelneale merged commit 5f50198 into main Dec 1, 2025
24 checks passed
@michaelneale
michaelneale deleted the term-dmo branch December 1, 2025 06:40
tlongwell-block added a commit that referenced this pull request Dec 1, 2025
* origin/main:
  Feat/automatic update installation (#5345)
  fix: Added "Merged consecutive assistant messages" to the acceptable issues for moim injection check (#5933)
  fix: anthropic provider model fetching (#5932)
  [MCP-UI] add CSP for images to proxy HTML (#5931)
  fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902)
  feat: @goose in terminal (native terminal support) (#5887)
  docs: adding AI-friendly features (#5918)
  Blog/advent of ai announcement (#5917)
  Extension selector behind ALPHA flag (#5892)
zanesq added a commit that referenced this pull request Dec 1, 2025
* 'main' of github.com:block/goose:
  fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902)
  feat: @goose in terminal (native terminal support) (#5887)
  docs: adding AI-friendly features (#5918)
  Blog/advent of ai announcement (#5917)
katzdave added a commit that referenced this pull request Dec 1, 2025
…nses-streaming

* 'main' of github.com:block/goose:
  Feat/automatic update installation (#5345)
  fix: Added "Merged consecutive assistant messages" to the acceptable issues for moim injection check (#5933)
  fix: anthropic provider model fetching (#5932)
  [MCP-UI] add CSP for images to proxy HTML (#5931)
  fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902)
  feat: @goose in terminal (native terminal support) (#5887)
  docs: adding AI-friendly features (#5918)
  Blog/advent of ai announcement (#5917)
  Extension selector behind ALPHA flag (#5892)
  blog: typo fixes (#5896)
  blog: fixing img url (#5895)
  blog: MCPs for Developers (#5884)
  docs: Extension Manager MCP (#5883)
  Update cleanup marker logic for Fedora users. (#5868)
  Improve AWS credential loading and configuration handling in BedrockProvider  (#5699)
zanesq added a commit that referenced this pull request Dec 2, 2025
…0-5147

* 'main' of github.com:block/goose: (243 commits)
  chore: upgrade npm packages (#5951)
  feat: ActionRequired (#5897)
  feat(acp): support loading sessions in acp (#5942)
  docs: add videos to multi-model page (#5938)
  docs: promote planning guide (#5934)
  fix: use a lock to ensure only need to run tunnel just in case multiple go… (#5885)
  Feat: Added custom headers and toggle keyring CLI options (#5017)
  Feat/automatic update installation (#5345)
  fix: Added "Merged consecutive assistant messages" to the acceptable issues for moim injection check (#5933)
  fix: anthropic provider model fetching (#5932)
  [MCP-UI] add CSP for images to proxy HTML (#5931)
  fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902)
  feat: @goose in terminal (native terminal support) (#5887)
  docs: adding AI-friendly features (#5918)
  Blog/advent of ai announcement (#5917)
  Extension selector behind ALPHA flag (#5892)
  blog: typo fixes (#5896)
  blog: fixing img url (#5895)
  blog: MCPs for Developers (#5884)
  docs: Extension Manager MCP (#5883)
  ...

# Conflicts:
#	crates/goose-server/src/routes/config_management.rs
#	crates/goose/src/providers/mod.rs
#	ui/desktop/openapi.json
#	ui/desktop/src/api/sdk.gen.ts
#	ui/desktop/src/api/types.gen.ts
#	ui/desktop/src/components/ProgressiveMessageList.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants